<?php

class NewsModule extends fvModule {
	
	function __construct () {
	    $moduleName = strtolower(substr(__CLASS__, 0, -6));

	    parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
	                        fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
	                        fvSite::$Layoult);
	}

	function showShort($params) {
	    $this->count = intval($params['count']);
	    $News = NewsManager::getInstance()->getAll(null, 'create_date DESC', $this->count);
	    $this->__assign("News", $News);
	    return $this->__display("short_list.tpl");
	}
	
	function showIndex($params) {
	    $this->count = intval($params['count']);
	    $News = NewsManager::getInstance()->getAll(null, 'create_date DESC', $this->count);
	    $this->__assign("News", $News);
	    return $this->__display("index.tpl");
	}
	
	function showOne($params) {
	   $id = fvRequest::getInstance()->getRequestParameter("id");
	   $NewsOne = NewsManager::getInstance()->getByPk($id);
	   $this->__assign("NewsOne", $NewsOne);
	   return $this->__display("one.tpl");
	}
}

?>
